#!/usr/bin/env python
# -*- coding: utf-8 -*-

import sys, os, re, string
import pygtk, glib, gtk, gtk.glade, pango, pynotify

pygtk.require("2.0")

reload(sys)
sys.setdefaultencoding('utf8')

class battery_info:
    def __init__(self, percent = 10, message = '请及时保存您的资料\n以免丢失'):
        self.config_path = os.getenv("HOME")+'/.battery_tray'
        if os.path.exists(self.config_path) == False:
            config_file = open(self.config_path, 'a+')
            config_file.write('%d\n%s' % (percent, message))
            config_file.close()
        else:
            config_file = open(self.config_path)
            self.low_percent = string.atoi(config_file.readline())
            self.low_message = config_file.read()
            config_file.close()
        self.low_init = 0
